#ifndef PROJECTMANAGEMENTPANEL_H
#define PROJECTMANAGEMENTPANEL_H

#include <projectexplorer/iprojectproperties.h>
#include <projectexplorer/session.h>
#include <projectexplorer/project.h>

#include <QtGui/QWidget>
#include <QtCore/QUrl>
#include <QtCore/QSettings>

const char * const MANAGEMENT_PANEL_ID("TracPlugin.ProjectManagementPanel");

// Clean up
using namespace ProjectExplorer;

class ProjectManagementPanelFactory : public IProjectPanelFactory
{
public:
    ProjectManagementPanelFactory(SessionManager *session);

    QString id() const;
    QString displayName() const;
    bool supports(Project *project);
    IPropertiesPanel *createPanel(Project *project);
private:
    SessionManager *m_session;
};

class ProjectManagementWidget;

class ProjectManagementPanel : public IPropertiesPanel
{
public:
    ProjectManagementPanel(SessionManager *session, Project *project);
    ~ProjectManagementPanel();
    QString displayName() const;
    QWidget *widget() const;
    QIcon icon() const;

private:
    ProjectManagementWidget *m_widget;
    const QIcon m_icon;
};

namespace Utils {
    class DetailsWidget;
}

namespace XmlRpc {
    class XmlRpcConnection;
}

class TrackTicketSetup : public QObject {
    Q_OBJECT
public:
    TrackTicketSetup();
    ~TrackTicketSetup();

    void saveSettings(const QString &username, const QString &password, const QUrl &url);

private:
    XmlRpc::XmlRpcConnection *m_con;
};

class QLineEdit;

class ProjectManagementWidget : public QWidget
{
    Q_OBJECT
public:
    ProjectManagementWidget(SessionManager *session, Project *project,
                       QWidget *parent = 0);
private slots:
    void save();
private:
    SessionManager *m_session;
    Project *m_project;
    Utils::DetailsWidget *m_detailsContainer;
    QSettings m_settings;
    QLineEdit *m_username;
    QLineEdit *m_password;
    QLineEdit *m_url;
};


#endif // PROJECTMANAGEMENTPANEL_H
